faApp.controller('FollowUpCtrl',['$scope','folllowUpService','$location','$controller','$route',function($scope,folllowUpService,$location,$controller,$route) {
	$controller('BaseCtrl', {$scope: $scope}); 

  $scope.list = [];
  $scope.loading = true;

	$scope.$watch('config',function(){
    if ($scope.watchIsChange()){
      folllowUpService.list($scope.config).then(function(json){
        $scope.list = json.list;
        $scope.pager = json.page;
        $scope.loading = false;
      });
    }
  },true)


	$scope.config = {
		"pageSize" : 20,
		"pageNo" : 1,
    "oType":"02"
	};

	$scope.pageChanged = function(){
		$scope.config.pageNo = $scope.pager.pageNo;
	}; 
  
  $scope.searchMap = {};

  $scope.search = function(){
    angular.forEach($scope.searchMap,function(o,i){
      $scope.config[i] = ( undefined == $scope.searchMap[i] ? "" : $scope.searchMap[i]);
    });

    $scope.config.pageNo = 1;
  };

 $scope.chooseOrderId = "";
  $scope.chooseOrderIdCount = 0;
  $scope.isShowOrderManagerLayer = false;
  $scope.t = "";
  $scope.orderList = [];
  
    //点击事件
$scope.changeShowOrderManagerLayer=function(){
  $scope.isShowOrderManagerLayer = true;
  folllowUpService.queryOrderList().then(function(json){
    $scope.orderList=json.list;
  });

}

}]);


faApp.controller('FollowUpViewCtrl',['$scope','folllowUpService','$location','$controller','$route','$routeParams',function($scope,folllowUpService,$location,$controller,$route,$routeParams) {   
  $controller('BaseCtrl', {$scope: $scope}); 

  $scope.id = $routeParams.id;
  $scope.item = {};
  $scope.loading = true;
  $scope.review = {'status':'02','id':$scope.id};

  folllowUpService.query({id:$scope.id}).then(function(json){
    if (json.list.length){
      $scope.item = json.list[0] || {};
      $scope.item['faInfo']['faShowName'] = $scope.item.faInfo.uName || $scope.item.faInfo.uRealName || $scope.item.faInfo.uLogin;
    }
    $scope.loading = false;
    
  });
  
  $scope.save = function(id){
    folllowUpService.edit($scope.review).then(function(json){
      if (json.statusCode){
        alert("出错了:" + json.statusCode);
      }else{
        $location.path("/order/followUp/simu/list");
      }
    });
  };
 
}]);


